package com.hyh.shiyanshiguanli.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.hyh.shiyanshiguanli.domain.dto.PageDTO;
import com.hyh.shiyanshiguanli.domain.entity.OutStorage;
import com.hyh.shiyanshiguanli.domain.result.PageResult;
import com.hyh.shiyanshiguanli.mapper.OutStorageMapper;
import com.hyh.shiyanshiguanli.service.OutStorageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author hyh
 * @version 1.0
 */
@Service
@SuppressWarnings({"all"})
public class OutStorageServiceImpl implements OutStorageService {

    @Autowired
    OutStorageMapper outStorageMapper;

    @Override
    public PageResult page(PageDTO pageDTO) {

        PageHelper.startPage(pageDTO.getPage(),pageDTO.getPageSize());
        Page<OutStorage> outStorages = outStorageMapper.page(pageDTO);
        long total = outStorages.getTotal();
        List<OutStorage> result = outStorages.getResult();
        PageResult result1 = new PageResult();
        result1.setTotal(total);
        result1.setRecodes(result);
        return result1;

    }
}
